var e = getApp();

Component({
    properties: {
        recommendOrder: {
            type: Object,
            value: []
        }
    },
    data: {
        isHidden: !0
    },
    methods: {
        hide: function() {
            this.setData({
                isHidden: !0
            });
        },
        show: function() {
            this.setData({
                isHidden: !1
            });
        },
        _clickSetting: function() {
            wx.navigateTo({
                url: "/pages/sendOrder/orderSetting/orderSetting"
            });
        },
        _close: function() {
            this.triggerEvent("close", {}), this._submitWeddingOrderAskLookClick(this.data.recommendOrder.askIds, 0), 
            this.hide();
        },
        _more: function() {
            this.triggerEvent("more", {}), wx.navigateTo({
                url: "/pages/order/myOrder/myOrder"
            }), this._submitWeddingOrderAskLookClick(this.data.recommendOrder.askIds, 1), this.hide();
        },
        _qian: function() {
            this.triggerEvent("qian", {}), this.commitQianDan(this.data.recommendOrder.weddingOrderId, !1), 
            this._submitWeddingOrderAskLookClick(this.data.recommendOrder.askIds, 2);
        },
        priceAddCancel: function(e) {
            this.prompt.hideDialog();
        },
        priceAddOk: function(e) {
            this.prompt.hideDialog();
            var t = e.detail;
            this.commitQianDan(this.data.recommendOrder.weddingOrderId, !0, t.marketPrice, t.cooperatePrice);
        },
        commitQianDan: function(t, a, i, d) {
            var o, n = this;
            o = 1 == a ? {
                marketPrice: i,
                cooperationPrice: d,
                weddingOrderId: t
            } : {
                weddingOrderId: t
            }, e.network.post({
                url: e.url.QiangDanWeddingOrder,
                params: o,
                before: function() {
                    wx.showLoading({
                        title: "正在抢单"
                    });
                },
                success: function(e) {
                    wx.hideLoading();
                    e.data.result;
                    1 == e.data.result ? (n.hide(), 1 == e.data.data.openAutoQiangDan ? wx.showModal({
                        title: "抢单成功",
                        content: "您的资料已提交给对应发单人，对方如有合作意向，将主动与您联系，请您留意。建议开启自动抢单，抢单快人一步",
                        confirmText: "自动抢单",
                        success: function(e) {
                            e.confirm && wx.navigateTo({
                                url: "/pages/sendOrder/orderSetting/orderSetting"
                            });
                        }
                    }) : wx.showModal({
                        title: "抢单成功",
                        content: "您的资料已提交给对应发单人，对方如有合作意向，将主动与您联系，请您留意。",
                        showCancel: !1
                    })) : 2 == e.data.result ? wx.showModal({
                        title: "提示",
                        content: e.data.message,
                        showCancel: !1
                    }) : 3 == e.data.result ? (n.prompt = n.selectComponent("#addPriceDialog"), n.prompt.showDialog(e.data.data.marketPrice, e.data.data.cooperationPrice)) : 4 == e.data.result ? wx.showModal({
                        title: "提示",
                        content: e.data.message,
                        success: function(e) {
                            if (e.confirm) {
                                var t = e.data.data.type;
                                1 == t ? wx.navigateTo({
                                    url: "/pages/add/addImage/addImage"
                                }) : 2 == t ? wx.navigateTo({
                                    url: "/pages/add/addVideo/addVideo"
                                }) : 3 == t && wx.navigateTo({
                                    url: "/pages/add/addTuwen/addTuwen"
                                });
                            }
                        }
                    }) : wx.showModal({
                        title: "提示",
                        content: e.data.message,
                        showCancel: !1
                    });
                },
                fail: function() {
                    wx.hideLoading(), e.util.showToast("获取数据失败");
                },
                complete: function() {
                    wx.hideNavigationBarLoading();
                }
            });
        },
        _submitWeddingOrderAskLookClick: function(t, a) {
            e.network.post({
                url: e.url.SubmitWeddingOrderAskLook,
                params: {
                    askIds: t,
                    type: a
                },
                before: function() {},
                success: function(e) {
                    console.log(e.data.message);
                },
                fail: function() {},
                complete: function() {}
            });
        }
    }
});